package cn.doitedu.javase.calculate_engine.commons;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

public class SocketSender {

    OutputStream socketOutputStream;
    
    public SocketSender(OutputStream socketOutputStream) {
        this.socketOutputStream = socketOutputStream;
    }


    public void send(String json) throws IOException {
        socketOutputStream.write((json+"\n").getBytes(StandardCharsets.UTF_8));
        socketOutputStream.flush();
    }
}
